/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rw.table.render;

import com.rw.table.TableInfo;
import java.awt.Color;
import javax.swing.JTable;

/**
 *
 * @author Rene Tapia
 */
public abstract class ACellRenderer implements ICellRenderer {

    public Color getColor(TableInfo info) {
        JTable table = info.getTable();
        boolean selected = info.isSelected();
        Color bg = info.getBackgroundColor();

        if (bg != null) {
            return selected ? table.getSelectionBackground() : bg;
        } else {
            return selected ? table.getSelectionBackground() : table.getBackground();
        }
    }
}
